<%--
  Created by IntelliJ IDEA.
  User: 周鹏
  Date: 2020/12/15
  Time: 11:08
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
    <script>
        $(function () {
            $("#btn").click(function () {
                $.post("${pageContext.request.contextPath}/book/getList",function (data) {
                    console.log(data);
                    var html="";
                    for (let i=0;i<data.length;i++)
                    {
                    html +="<tr>"+
                        "<td>"+data[i].bookID+"</td>"+
                        "<td>"+data[i].bookName+"</td>"+
                        "<td>"+data[i].bookCounts+"</td>"+
                        "<td>"+data[i].detail+"</td>"+
                        "</tr>"

                    }
                    $("#content").html(html);
                });
            })
        });


    </script>
</head>
<body>
<input type="button" value="获取用户数据" id="btn">
<table>
    <td>书籍编号</td>
    <td>书名</td>
    <td>书籍数量</td>
    <td>书籍评论</td>
    <tbody id="content">

    </tbody>
</table>

</body>
</html>